<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<center>
		<form action="{url:/test/join_do}" method="post">
			<table>
				<tr>
					<td>用户名:</td>
					<td><input type="text" name="u_name"></td>
				</tr>
				<tr>
					<td>密码:</td>
					<td><input type="password" name="u_pwd"></td>
				</tr>
				<tr>
					<td>邮箱:</td>
					<td><input type="email" name="u_email"></td>
				</tr>
				<tr>
					<td><input type="button" id="button" value="注册"></td>
				</tr>
			</table>
		</form>
	</center>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
	$("#button").click(function(){
		var u_name = $("[name='u_name']").val();
		var u_pwd = $("[name='u_pwd']").val();
		var u_email = $("[name='u_email']").val();
		if (u_name == "") {
			alert("用户名不能为空");
			return false;
		}
		if (u_pwd == "") {
			alert("密码不能为空");
			return false;
		}
		 var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            if(!myreg.test(u_email))
            {
                 alert('提示\n\n请输入有效的E_mail！');
                myreg.focus();                 return false;
            }
        $("form").submit();
	})
</script>

